package ctm.javacode;

import java.util.Random;

public class lib {
	
	public static String GeneratePW () {
				
		int i = 0, r = 0;
		String newPW = "";
		Random ran = new Random();
		while ( i < 8) {			
			r = (int)ran.nextInt(9+1);
			newPW= newPW + Integer.toString(r) ;
			i++ ;
		} // end while
		
		return newPW;		
	} // end NewPW()
	
	public static String GenTimeStamp( String filename ) {
		int walk = 0, count = 0,count2 = 0 , flag = 1;
		String timeStamp = "" ;
		while ( walk < filename.length()) {
			if ( filename.charAt(walk) == '_' ) {
				count2++;
				count++;
				if(count2 > 2){
					if(flag == 1){
						timeStamp = timeStamp + " ";
						flag=0;
					}
					else{
						timeStamp = timeStamp + ":";
					}
				}
				else{
					timeStamp = timeStamp + "/";
				}
			} // end if
			else {
				timeStamp = timeStamp + filename.charAt(walk) ;
			} // end else
				
			walk++;
		} // end while
		
		return timeStamp ;
	} // end GenTimeStamp()

} // end class
